/*
 *fork( )返回两个值,一个返回给父进程( 子进程的id ),一个返回给子进程( 0 )
 */

#include<unistd.h>
#include<sys/types.h>

int main(  ){
	pid_t pid;
	printf( "fork!\n" );//printf( "fork!" );

	pid = fork( );
	
	if( pid < 0 )
		printf( "error in fork" );
	else if( pid == 0 )
		printf( "I am the child process, my process id is %d\n", getpid( ) );
	else
		printf( "I am the parent process, my process id is %d\n", getpid( ) );

}
